package com.pb.camera.utils;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;

public class LinkSDK {

	public static String UUID = "";

	private static Context context = null;
	private static LinkSDK instance = null;

	public static void init(Context ctx) {
		getInstance();
		context = ctx;

		if (!Settings.getInstance(context).get("uuid", "").equals("")) {
			UUID = Settings.getInstance(context).get("uuid");
		} else {
			try {
				UUID = DriveUUIDUtil.getDriverUUID(context);
			} catch (Exception e){}
			if (TextUtils.isEmpty(UUID) || UUID.length() < 5) {
				UUID = "11-22-33-44-55:F";
			}
			Settings.getInstance(context).set("uuid", UUID);
		}

		Assert.notNEWS(UUID);
		
		Log.d("uuid", "uuid == " + UUID);
	}

	public static Context getAppContext() {
		//FIXME: here need be fix,after merge!!!!!!!
		//return app.getInstance();
		return null;
	}

	public static String getDeviceId() {
		return UUID;
	}

	private LinkSDK() {
	}

	public static LinkSDK getInstance() {
		if (instance == null) {
			synchronized (LinkSDK.class) {
				if (instance == null) {
					instance = new LinkSDK();
				}
			}
		}
		return instance;
	}
}
